/**
 * Created by Administrator on 2017/4/25.
 */
var Progress = require('../../../../src/libs/progress');
var InvestAction = require('../investAction');
var ProjectList = React.createClass({
    getDefaultProps:function(){
        return{
            projectList: []
        }
    },
    render:function(){
        var _this = this;
        return(
            <div className="project-list clearfix" ref="project-list">
                {
                    _this.props.projectList.length > 0 ? (
                        _this.props.projectList.map(function(item,index){
                            //投资动作Props
                            var actionData = {
                                minFlag:item.minFlag?item.minFlag:true,
                                flag:{
                                    login:item.login,
                                    loginUrl:item.loginUrl?item.loginUrl:"",
                                    confirmUrl:item.confirmUrl?item.confirmUrl:"",
                                    ProjectStatus:item.ProjectStatus.value?item.ProjectStatus.value:"",
                                    JMBeginTime:item.JMBeginTime.value?item.JMBeginTime.value:"",
                                    ProjectBeginTime:item.ProjectBeginTime.value?item.ProjectBeginTime.value:""
                                }
                            };
                            return (
                                <div className="item">
                                    <h3><a href={item.login?item.confirmUrl:item.loginUrl}>{item.ProjectName?item.ProjectName.value:""}</a>{(item.IsExclusive && item.IsExclusive.value == "1")?(<span className="bg-icon tag tag-zhuang "></span>):("")}</h3>
                                    <ul>
                                        <li className="col-1">{item.Interest?(<span className="fc-main fs18"><b>{item.Interest.value}</b>%</span>):""}{item.Interest?(<span className="fc-light"> 年化利率</span>):""}</li>
                                        <li className="col-2">{item.Duration?(<span className="fc-dark fs20">{item.Duration.value+"天"}</span>):""}{item.Duration?(<span className="fc-light"> 项目期限</span>):""}</li>
                                        <li className="col-3">{item.TotalAmount?(<span className="fc-dark fs20">{item.TotalAmount.value+"万"}</span>):""}{item.TotalAmount?(<span className="fc-light"> 项目规模</span>):""}</li>
                                        <li className="col-4">
                                            {item.Progress?(<Progress className="progress" type="line" percent={item.Progress.value}></Progress>):""}
                                            {item.MinAmount?(<p>{item.MinAmount.value}元起投</p>):""}
                                        </li>
                                        <li className="col-5">
                                            <InvestAction data={actionData}/>
                                        </li>
                                    </ul>
                                    <div className="clear"></div>
                                </div>
                            )
                        })
                    ):(<div className="nodata">项目正在筹备中，敬请期待！</div>)
                }
            </div>
        )
    }
});
module.exports = ProjectList;